﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.Data.Entities;

namespace Backend.Data.Mappings
{
    class LegalEntityMap : EntityTypeConfiguration<LegalEntity>
    {
        public LegalEntityMap()
        {
            //table
            ToTable("LegalEntitys");

            //pk
            HasKey(t => t.Id);

            //property
            Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(t => t.Code)
                .IsOptional();
            Property(t => t.LegalName)
                .IsOptional();
            Property(t => t.Logo)
                .IsOptional();
            Property(t => t.Alias)
                .IsOptional();
            Property(t => t.Name)
                .IsRequired();

        }
    }
}
